package mlz.c_printstream;

import org.junit.Test;

import java.io.FileNotFoundException;
import java.io.PrintStream;

/*
    重定向输出语句
 */
public class PrintStreamDemo02 {
    @Test
    public void test01() throws FileNotFoundException {
        /*System.out.println("你好世界!!");
        System.out.println("hello世界");*/

        PrintStream ps = new PrintStream("print2.txt");
        //把系统默认的打印流对象修改成自己设置的打印流
        System.setOut(ps);

        System.out.println("你好世界!!");
        System.out.println("hello世界");
    }
}
